using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace gnodotnet.Core {
    public class EntitySpec : Dictionary<string, object> {
    }
    public class EntitySpec<T> {
        private Dictionary<string, object> _dict = new Dictionary<string, object>();
        public EntitySpec<T> With<R>(Expression<Func<T, R>> expr, R value) {
            _dict.Add(MembersOf<T>.GetName<R>(expr), value);
            return this;
        }
        public IDictionary<string, object> ToD() {
            return new Dictionary<string, object>(_dict);
        }
        public static implicit operator Dictionary<string, object>(EntitySpec<T> spec) {
            return new Dictionary<string, object>(spec._dict);
        }
    }
}
